package com.ruoyi.project.qyxy.qua.controller;

import java.util.List;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.framework.aspectj.lang.annotation.Log;
import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
import com.ruoyi.project.qyxy.qua.domain.QuaPersionConfig;
import com.ruoyi.project.qyxy.qua.service.IQuaPersionConfigService;
import com.ruoyi.framework.web.controller.BaseController;
import com.ruoyi.framework.web.domain.AjaxResult;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.framework.web.page.TableDataInfo;

/**
 * 资质人员参数Controller
 * 
 * @author lcl
 * @date 2021-03-06
 */
@RestController
@RequestMapping("/qyxy/quapcfg")
public class QuaPersionConfigController extends BaseController
{
    @Autowired
    private IQuaPersionConfigService quaPersionConfigService;

    /**
     * 查询资质人员参数列表
     */
    @PreAuthorize("@ss.hasPermi('qyxy:quapcfg:list')")
    @GetMapping("/list")
    public TableDataInfo list(QuaPersionConfig quaPersionConfig)
    {
        startPage();
        List<QuaPersionConfig> list = quaPersionConfigService.selectQuaPersionConfigList(quaPersionConfig);
        return getDataTable(list);
    }

    /**
     * 导出资质人员参数列表
     */
    @PreAuthorize("@ss.hasPermi('qyxy:quapcfg:export')")
    @Log(title = "资质人员参数", businessType = BusinessType.EXPORT)
    @GetMapping("/export")
    public AjaxResult export(QuaPersionConfig quaPersionConfig)
    {
        List<QuaPersionConfig> list = quaPersionConfigService.selectQuaPersionConfigList(quaPersionConfig);
        ExcelUtil<QuaPersionConfig> util = new ExcelUtil<QuaPersionConfig>(QuaPersionConfig.class);
        return util.exportExcel(list, "quapcfg");
    }

    /**
     * 获取资质人员参数详细信息
     */
    @PreAuthorize("@ss.hasPermi('qyxy:quapcfg:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return AjaxResult.success(quaPersionConfigService.selectQuaPersionConfigById(id));
    }

    /**
     * 新增资质人员参数
     */
    @PreAuthorize("@ss.hasPermi('qyxy:quapcfg:add')")
    @Log(title = "资质人员参数", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody QuaPersionConfig quaPersionConfig)
    {
        return toAjax(quaPersionConfigService.insertQuaPersionConfig(quaPersionConfig));
    }

    /**
     * 修改资质人员参数
     */
    @PreAuthorize("@ss.hasPermi('qyxy:quapcfg:edit')")
    @Log(title = "资质人员参数", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody QuaPersionConfig quaPersionConfig)
    {
        return toAjax(quaPersionConfigService.updateQuaPersionConfig(quaPersionConfig));
    }

    /**
     * 删除资质人员参数
     */
    @PreAuthorize("@ss.hasPermi('qyxy:quapcfg:remove')")
    @Log(title = "资质人员参数", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(quaPersionConfigService.deleteQuaPersionConfigByIds(ids));
    }
}
